package com.usian.behavior.behavior.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.usian.behavior.behavior.mapper.ApLikesBehaviorMapper;
import com.usian.behavior.behavior.mapper.FollowBehaviorMapper;
import com.usian.model.article.ArticleInfoDto;
import com.usian.model.behavior.pojo.ApFollowBehavior;
import com.usian.model.behavior.pojo.ApLikesBehavior;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/behavior/api/likes/")
public class LikesBehaviorController {

    @Autowired
    private ApLikesBehaviorMapper apLikesBehaviorMapper;

    //阅读
    @PostMapping("findById")
    public ApLikesBehavior getLikesByid(@RequestBody ArticleInfoDto dto){
        LambdaQueryWrapper<ApLikesBehavior> q = new LambdaQueryWrapper<>();
        q.eq(ApLikesBehavior::getEntryId,dto.getEntryId());
        q.eq(ApLikesBehavior::getArticleId,dto.getArticleId());
        ApLikesBehavior apBehaviorEntry = apLikesBehaviorMapper.selectOne(q);
        return apBehaviorEntry;
    }
}
